package com.shuoyue.adven.main.bussiness;

import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.viewpager.widget.ViewPager;

import com.danikula.videocache.HttpProxyCacheServer;
import com.dueeeke.videoplayer.player.VideoView;
import com.shuoyue.adven.Constant;
import com.shuoyue.adven.R;
import com.shuoyue.adven.cache.ProxyVideoCacheManager;
import com.shuoyue.adven.entity.Adv;
import com.shuoyue.adven.entity.ImpotentResult;
import com.shuoyue.adven.entity.Property;
import com.sm.appbase.base.basemvp.BaseMvpFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class FragmentPropertyInfo extends BaseMvpFragment<MainContract.Presenter> implements MainContract.View {
    @BindView(R.id.adv_name)
    public TextView adv_name;
    @BindView(R.id.adv_contact)
    public TextView adv_contact;
    Runnable netTask;
    Handler handler;

    @Override
    public void initParams(Bundle bundle) {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.propery_info;
    }

    @Override
    protected void initView() {

    }

    @Override
    public void initData() {
        mPresenter = new MainContract.Presenter();
        mPresenter.attachView(this);
        initTimerTask();
    }

    void initTimerTask() {
        handler = new Handler();
        netTask = () -> {
            handler.postDelayed(netTask, Constant.NET_TASK * 1000);
            doNetTask();
        };
        handler.post(netTask);
    }

    void doNetTask() {
        mPresenter.getPropertyInfo();
    }

    @Override
    public void onStop() {
        super.onStop();
    }



    @Override
    public void queryBusinessAdvSuc(List<Adv> mData) {
    }

    @Override
    public void queryPropertyAdvSuc(List<Adv> videoList) {
    }

    @Override
    public void queryImpotentAdvSuc(ImpotentResult mdata) {
    }

    @Override
    public void getPropertyInfoSuc(Property propertyInfo) {
        if(adv_contact!=null&&adv_name!=null){
            adv_name.setText(propertyInfo.getTitle());
            adv_contact.setText("物业电话：" + propertyInfo.getLinkphone());
        }

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
